package cn.edu.scau.cmi.yanghaorui.comprehensiveExperimentFxml;

import java.util.Scanner;

import cn.edu.scau.cmi.yanghaorui.abstractFactory.factory.AbstractFactory;
import cn.edu.scau.cmi.yanghaorui.abstractFactory.factory.AonongFactory;
import cn.edu.scau.cmi.yanghaorui.abstractFactory.factory.TianbangFactory;
import cn.edu.scau.cmi.yanghaorui.abstractFactory.factory.WensFactory;
import cn.edu.scau.cmi.yanghaorui.client.AbstractFactoryClient;
import cn.edu.scau.cmi.yanghaorui.client.AdapterClient;
import cn.edu.scau.cmi.yanghaorui.client.CombinationConsistentClient;
import cn.edu.scau.cmi.yanghaorui.client.CombinationSafeClient;
import cn.edu.scau.cmi.yanghaorui.client.FactoryClient;
import cn.edu.scau.cmi.yanghaorui.client.HibernateClient;
import cn.edu.scau.cmi.yanghaorui.client.MultipletonClient;
import cn.edu.scau.cmi.yanghaorui.client.SimpleFactoryMethodClient;
import cn.edu.scau.cmi.yanghaorui.client.SingletonClient;
import cn.edu.scau.cmi.yanghaorui.client.SpringApplicationContextClient;
import cn.edu.scau.cmi.yanghaorui.client.SpringHibernateSession;
import cn.edu.scau.cmi.yanghaorui.factory.BeefFactory;
import cn.edu.scau.cmi.yanghaorui.factory.ChickenFactory;
import cn.edu.scau.cmi.yanghaorui.factory.MeatFactorys;
import cn.edu.scau.cmi.yanghaorui.factory.PorkFactory;
import cn.edu.scau.cmi.yanghaorui.interProgramming.GraduateStudent;
import cn.edu.scau.cmi.yanghaorui.interProgramming.UndergraduateStudent;
import cn.edu.scau.cmi.yanghaorui.simpleFactoryMethod.MeatFactory;
import cn.edu.scau.cmi.yanghaorui.simpleFactoryMethod.domain.Meat;
import javafx.event.ActionEvent;

//import java.awt.event.ActionEvent;

//import cn.scau.myfxml.*;
import javafx.fxml.FXML;//记得加入这个包
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;

public class ComprehensiveMyController {
	public ComprehensiveMyController() {
		
	}
	
	@FXML
	private Label fxmllabel;
	
	public Button getButton() {
		return button;
	}


	public void setButton(Button button) {
		this.button = button;
	}


	public TextArea getArea() {
		return area;
	}


	public void setArea(TextArea area) {
		this.area = area;
	}


	public ComboBox getMenu() {
		return menu;
	}


	public void setMenu(ComboBox menu) {
		this.menu = menu;
	}

	@FXML
	private Button button;
	
	@FXML
	private TextArea area;
	
	@FXML
	private ComboBox menu;
	
	@FXML
	private Label picture;
	
	public Label getPicture() {
		return picture;
	}


	public void setPicture(Label picture) {
		this.picture = picture;
	}


	public Label getFxmllabel() {
		return fxmllabel;
	}


	public void setFxmllabel(Label fxmllabel) {
		this.fxmllabel = fxmllabel;
	}
    
	@FXML
	private void eventAction1(ActionEvent event)
	{
		System.out.println("实验一：接口编程");
		GraduateStudent graduateStudent=new GraduateStudent();
		UndergraduateStudent undergraduateStudent=new UndergraduateStudent();
		graduateStudent.learning();
		undergraduateStudent.learning();
		
	}

	@FXML
	private void eventAction2(ActionEvent event) throws Exception
	{
		System.out.println("实验二：单例模式");
		SingletonClient s=new SingletonClient();
		s.start(new Stage());

		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}

	@FXML
	private void eventAction3(ActionEvent event) throws Exception
	{
		System.out.println("实验二：多例模式");
        MultipletonClient s=new MultipletonClient();
        s.start(new Stage());
		//System.out.println("6666666666666");
		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}

	@FXML
	private void eventAction4(ActionEvent event)
	{
		System.out.println("实验三：简单工厂");
		SimpleFactoryMethodClient.main(null);
		/*System.out.println("实验三：简单工厂");
		char c = '0';
		while(true) {
			System.out.println("请输入您想生产的肉类：1.生产牛肉 2.生产猪肉 3.生产鸡肉 4.退出");
			Scanner sc = new Scanner(System.in);
			c =sc.next().charAt(0);    
			if(c=='1') {
				Meat beaf = MeatFactory.getMeat("beef");
				beaf.cook();
			}
			else if(c=='2') {
				Meat pork = MeatFactory.getMeat("pork");
				pork.cook();
			}
			else if(c=='3') {
				Meat chicken = MeatFactory.getMeat("chicken");
				chicken.cook();
			}
			else if(c=='4'){
				System.out.println("退出生产！");
				break;
			}
			else {
				System.out.println("无效输入，请重新输入！");
			}
		}*/

	

		//System.out.println("6666666666666");
		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}

	@FXML
	private void eventAction5(ActionEvent event)
	{
		System.out.println("实验三：工厂模式");
		FactoryClient.main(null);
		
	}

	@FXML
	private void eventAction6(ActionEvent event)
	{
		System.out.println("实验三：抽象工厂");
		AbstractFactoryClient.main(null);
				
	}

	@FXML
	private void eventAction7(ActionEvent event)
	{
		System.out.println("实验四：安全组合");
        CombinationSafeClient.main(null);
		//System.out.println("6666666666666");
		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}
	
	@FXML
	private void eventAction8(ActionEvent event)
	{
		System.out.println("实验四：一致组合");
        CombinationConsistentClient.main(null);
		//System.out.println("6666666666666");
		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}

	@FXML
	private void eventAction9(ActionEvent event)
	{
		System.out.println("实验五：类适配器/对象适配器");
        AdapterClient ac=new AdapterClient();
        ac.start(new Stage());
		//System.out.println("6666666666666");
		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}
	
	@FXML
	private void eventAction10(ActionEvent event)
	{
		System.out.println("实验六：Hibernate");
        HibernateClient.main(null);
		//System.out.println("6666666666666");
		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}
	
	@FXML
	private void eventAction11(ActionEvent event)
	{
		System.out.println("实验七：毕业答辩");
        SpringApplicationContextClient.main(null);
		//System.out.println("6666666666666");
		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}
	
	@FXML
	private void eventAction12(ActionEvent event)
	{
		System.out.println("实验七：Spring+Hibernate+DAO");
        SpringHibernateSession.main(null);
		//System.out.println("6666666666666");
		//area.appendText("666");
		//area.appendText((String) menu.getValue()+"\n");
		
	}

	@FXML
	private void initialize() {
		System.out.println("初始化完成！");
	}
	

}

